function GM:UpdateAnimation( ply, velocity, maxseqgroundspeed )	
	local len2d = velocity:Length2D()
	local rate = 1
	
	if len2d > 0.5 then
		rate = (len2d --[[* RSCALE]]) / maxseqgroundspeed
	end
	
	ply:SetPlaybackRate(math.min(rate, 3))
end

function GM:CalcMainActivity( ply, velocity )	
	ply.CalcIdeal = ACT_MP_STAND_IDLE
	ply.CalcSeqOverride = -1
	
	if self:HandlePlayerDriving( ply ) ||
		self:HandlePlayerJumping( ply, velocity ) ||
		self:HandlePlayerDucking( ply, velocity ) ||
		self:HandlePlayerSwimming( ply ) then
		
	else
		local len2d = velocity:Length2D()
		
		if len2d > 210 * SCALE then
			ply.CalcIdeal = ACT_MP_RUN
		elseif len2d > 0.5 then
			ply.CalcIdeal = ACT_MP_WALK
		end
	end
	
	// a bit of a hack because we're missing ACTs for a couple holdtypes
	local weapon = ply:GetActiveWeapon()
	
	if ply.CalcIdeal == ACT_MP_CROUCH_IDLE &&
		IsValid(weapon) &&
		( weapon:GetHoldType() == "knife" || weapon:GetHoldType() == "melee2" ) then
		
		ply.CalcSeqOverride = ply:LookupSequence("cidle_" .. weapon:GetHoldType())
	end
	
	return ply.CalcIdeal, ply.CalcSeqOverride
end
